﻿/*----------------------------------------------------------------
 * 
 * 版权所有：Copyright (C) 2012 
 * 
 * 文件名：HomeController.cs
 * 文件功能描述：
 * 
 * 
 * 作 者：zhangq
 * 邮 箱：zhangqiang@bamabest.com
 * 日 期：2013-02-25 02:52:30
 * 
 * 
 * 修改标识： Author
 * 修改描述： 相关描述
 * 
 * ---------------------------------------------------------------- */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common.Extensions.OrderBy;
using Common.Extensions.Where;
using DomainModel;
using IManager;

namespace WebPlatform.Areas.CPP.Controllers
{

    /// <summary>
    /// 
    /// </summary>
    public class CPartialController : Controller
    {


        public IManagerLinks IMLinks { get; set; }


        /// <summary>
        /// 
        /// </summary>
        public ActionResult Index()
        {
            return View();
        }



        /// <summary>
        /// 导航
        /// </summary>
        /// <returns></returns>
        public ActionResult Menu(string current)
        {
            string className = "ali-nav-current";
            switch (current)
            {
                case "EZine":
                    ViewBag.EZine = className;
                    break;
                case "HSDT":
                    ViewBag.HSDT = className;
                    break;
                default:
                    ViewBag.IndexPage = className;
                    break;
            }
            return PartialView();
        }


        /// <summary>
        /// 头部搜索
        /// </summary>
        /// <returns></returns>
        public ActionResult Header(string filters, string filterType)
        {
            ViewBag.filters = filters;
            ViewBag.filterType = string.IsNullOrEmpty(filterType) ? "1" : filterType;
            if (ViewBag.filterType == "4")
            {
                ViewBag.ZCurrent = "current";
            }
            if (ViewBag.filterType == "3")
            {
                ViewBag.DCurrent = "current";
            }
            if (ViewBag.filterType == "2")
            {
                ViewBag.CCurrent = "current";
            }
            if (ViewBag.filterType == "1")
            {
                ViewBag.PCurrent = "current";
            }

            return PartialView();
        }


        /// <summary>
        /// 头部菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult TopMenu()
        {
            return PartialView();
        }


        /// <summary>
        /// 底部
        /// </summary>
        /// <returns></returns>
        public ActionResult Footer()
        {
            return PartialView();
        }



        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ActionResult Advert(string floor)
        {
            var where = PredicateExtension.True<LinksInfo>();
            where = where.And(u=>u.CompanyId == 1 && u.Types == floor);
            var links = IMLinks.LoadAll(where, 1, 1, new OrderByExpression<LinksInfo, int>(u => u.Id, true));

            return PartialView(links);
        }

    }
}
